import Vue from "vue";
import Router from "vue-router";
import Login from "@/components/Login";
import Home from "@/components/Home";
import Register from "@/components/Register";
import Index from "@/components/Index";
import Mall from "@/components/Mall";
import VIP from "@/components/VIP";
import Message from "@/components/message";
import OriginalQuestion from "@/components/OriginalQuestion";
import UpdateQuestion from "@/components/UpdateQuestion";
import ViewQuestion from "@/components/ViewQuestion";
import Mine from "@/components/Mine";
import OriginalPaper from "@/components/OriginalPaper";
import TypeChoose from "@/components/TypeChoose";
import CreatPaper from "@/components/CreatPaper";
import MyTestPaper from "@/components/MyTestPaper";
import PreBase from "@/components/PreBase";
import NewPreBase from "@/components/NewPreBase";
import UpdatePreBase from "@/components/UpdatePreBase";
import ViewPreBase from "@/components/ViewPreBase";

Vue.use(Router);

export default new Router({
  mode: "hash",
  routes: [
    // 公用页面
    {
      path: "/",
      name: "登录",
      hidden: true,
      component: Login
    },
    {
      path: "/register",
      name: "注册",
      hidden: true,
      component: Register
    },
    {
      path: "/home",
      name: "",
      redirect: "/index",
      hidden: true
    },
    {
      path: "/home",
      component: Home,
      name: "我的信息",
      iconCls: "fa fa-reorder",
      hidden: false,
      children: [
        {
          path: "/index",
          iconCls: "fa fa-reorder",
          name: "我的信息",
          component: Index
        }
      ]
    },
    {
      path: "/home",
      component: Home,
      name: "试题市场",
      iconCls: "fa fa-reorder",
      hidden: false,
      children: [
        {
          path: "/mall",
          iconCls: "fa fa-reorder",
          name: "试题市场",
          component: Mall
        }
      ]
    },
    {
      path: "/home",
      component: Home,
      name: "公用页面",
      hidden: true,
      children: [
        {
          path: "/vip",
          iconCls: "fa fa-reorder",
          name: "VIP",
          component: VIP
        },
        {
          path: "/message",
          iconCls: "fa fa-reorder",
          name: "message",
          component: Message
        }
      ]
    },

    // 试题页面
    {
      path: "/home",
      component: Home,
      name: "原创试题",
      hidden: false,
      iconCls: "fa fa-reorder",
      children: [
        {
          path: "/originalQuestion",
          component: OriginalQuestion,
          iconCls: "fa fa-reorder",
          hidden: false,
          name: "原创试题"
        }
      ]
    },
    {
      path: "/home",
      component: Home,
      name: "原创试题",
      hidden: true,
      children: [
        {
          path: "/update_question",
          name: "修改试题",
          component: UpdateQuestion
        },
        {
          path: "/view_question",
          name: "试题详情",
          component: ViewQuestion
        },
        {
          path: "/mine",
          name: "我的试题",
          component: Mine
        }
      ]
    },

    // 试卷页面
    {
      path: "/home",
      component: Home,
      name: "原创试卷",
      iconCls: "fa fa-reorder",
      hidden: false,
      children: [
        {
          path: "/original_paper",
          iconCls: "fa fa-reorder",
          name: "原创试卷",
          component: OriginalPaper,
          meta: {
            keepAlive: true
          }
        }
      ]
    },
    {
      path: "/home",
      component: Home,
      name: "原创试卷",
      iconCls: "fa fa-reorder",
      hidden: true,
      children: [
        {
          path: "/creat_paper",
          iconCls: "fa fa-reorder",
          name: "试卷编辑",
          component: CreatPaper
        },
        {
          path: "/type_choose",
          iconCls: "fa fa-reorder",
          name: "类型选择",
          component: TypeChoose,
          meta: {
            keepAlive: true
          }
        },
        {
          path: "/mytest_paper",
          iconCls: "fa fa-reorder",
          name: "我的试卷",
          component: MyTestPaper
        }
      ]
    },
    // 类型预置
    {
      path: "/home",
      component: Home,
      name: "试卷类型预置",
      iconCls: "fa fa-reorder",
      hidden: false,
      children: [
        {
          path: "/pre_base",
          iconCls: "fa fa-reorder",
          name: "试卷类型预置",
          component: PreBase,
          hidden: false,
          meta: {
            keepAlive: true
          }
        }
      ]
    },
    {
      path: "/home",
      component: Home,
      name: "试卷类型预置",
      iconCls: "fa fa-reorder",
      hidden: true,
      children: [
        {
          path: "/new_pre_base",
          iconCls: "fa fa-reorder",
          name: "新建试卷类型预置",
          component: NewPreBase,
          meta: {
            keepAlive: true
          },
          hidden: true
        },
        {
          path: "/update_pre_base",
          iconCls: "fa fa-reorder",
          name: "更新试卷类型预置",
          component: UpdatePreBase,
          meta: {
            keepAlive: true
          },
          hidden: true
        }
      ]
    },
    {
      path: "/view_pre_base",
      component: ViewPreBase,
      name: "查看预置类型",
      iconCls: "fa fa-reorder",
      hidden: true
    }
  ]
});
